package hc.bre.data.setting

import hc.bre.cmn.IDataDefOption
import hc.bre.cmn.ListOption
import hc.bre.cmn.TreeOption

@groovy.transform.CompileStatic
@groovy.transform.ToString(includeNames=true,includePackage=false)
class SettingItem extends TreeOption<SettingItem> implements IDataDefOption{
	String type ='text';
	Object value;
	
	@Override
	public SettingItem load(Map map) {
		this.type = map['type']
		this.value = map['value']
		return super.load(map);
	}

	static public String accessRouteOf(int id, List<SettingItem> lst) {
		List<SettingItem> route = SettingItem.routeFrom(id, lst);
		return route.collect{it.code}.join('.')
	}
}
